home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 365_02 / prsvdos.c < prev    next >
C/C++ Source or Header  |  1992-04-04  |  1KB  |  51 lines

  1. /* prsvdos.c */
  2.  
  3. /* This file contains the DOS-specific parts of the "elvprsv" program. */
  4.  
  5. #include <stdio.h>
  6.  
  7. /* This function returns the login name of the owner of a file */
  8. char *ownername(filename)
  9.     char    *filename;    /* name of a file */
  10. {
  11.     return "user";
  12. }
  13.  
  14.  
  15. /* This function sends a mail message to a given user, saying that a file
  16.  * has been preserved.
  17.  */
  18. void mail(user, file, when)
  19.     char    *user;    /* name of user who should receive the mail */
  20.     char    *file;    /* name of original text file that was preserved */
  21.     char    *when;    /* description of why the file was preserved */
  22. {
  23.     char    cmd[80];/* buffer used for constructing a "mail" command */
  24.     FILE    *m;    /* stream used for giving text to the "mail" program */
  25.     char    *base;    /* basename of the file */
  26.  
  27.     /* separate the directory name from the basename. */
  28.     for (base = file + strlen(file); --base > file && *base != SLASH; )
  29.     {
  30.     }
  31.     if (*base == SLASH)
  32.     {
  33.         *base++ = '\0';
  34.     }
  35.  
  36.     /* for anonymous buffers, pretend the name was "foo" */
  37.     if (!strcmp(base, "*"))
  38.     {
  39.         base = "foo";
  40.     }
  41.  
  42.     /* Tell the user that the file was preserved */
  43.     printf("A version of your file \"%s%c%s\"\n", file, SLASH, base);
  44.     printf("was preserved when %s.\n", when);
  45.     printf("To recover this file, do the following:\n");
  46.     printf("\n");
  47.     printf("     C:\\> cd %s\n", file);
  48.     printf("     %s> elvrec %s\n", file, base);
  49.     printf("\n");
  50. }
  51.